Q tabs Class
This tool renders a nice set of tabs that adapts to different environments
Constructor
Q tabs
-
[options]
Parameters:
-
[options]
Object optionalThis object contains properties for this function
-
[tabs]
Array optionalAn associative array of name: title pairs.
-
[urls]
Array optionalAn associative array of name: url pairs to override the default urls.
-
[field='tab']
String optionalUses this field when urls doesn't contain the tab name.
-
[checkQueryString=false]
Boolean optionalWhether the default getCurrentTab should check the querystring when determining the current tab
-
[vertical=false]
Boolean optionalStack the tabs vertically instead of horizontally
-
[compact=false]
Boolean optionalDisplay the tabs interface in a compact space with a contextual menu
-
[overflow]
Object optional-
[content]
String optionalThe html that is displayed when the tabs overflow. You can interpolate {{count}}, {{text}} or {{html}} in the string. -
[glyph]
String optionalOverride the glyph that appears next to the overflow text. You can interpolate {{count}} here -
[defaultText]
String optionalThe text to interpolate {{text}} in the content when no tab is selected -
[defaultHtml]
String optionalThe text to interpolate {{text}} in the content when no tab is selected
-
-
[selectors]
String optionalObject of {slotName: selector} pairs, where the values are CSS style selectors indicating the element to update with javascript, and can be a parent of the tabs. Set to null to reload the page.
-
[slot]
String optionalThe name of the slot to request when changing tabs with javascript.
-
[loader]
Function optionalName of a function which takes url, slot, callback. It should call the callback and pass it an object with the response info. Can be used to implement caching, etc. instead of the default HTTP request. This function shall be Q.batcher getter
-
[onClick]
Q.Event optionalEvent when a tab was clicked, with arguments (name, element). Returning false cancels the tab switching.
-
[beforeSwitch]
Q.Event optionalEvent when tab switching begins. Returning false cancels the switching.
-
[beforeScripts]
Function optionalName of the function to execute after tab is loaded but before its javascript is executed.
-
[onCurrent]
Function optionalEvent after a tab has been selected. Note that this is in the view layer, so your handlers would trigger recursion if they call Q.layout().
-
[onActivate]
Function optionalEvent after a tab has been activated. Note that this is in the view layer, so your handlers would trigger recursion if they call Q.layout().
-
[beforeRefresh]
Function optionalEvent before tabs are going to be refreshed
-
[onRefresh]
Function optionalEvent after tabs have been refreshed
-
Returns:
Item Index
Methods
getCurrentTab
-
[tab]
Called by indicateCurrent. You can override this function to provide your own mechanisms for indicating the current tab and returning it.
Parameters:
-
[tab]
String optionala possible tab the caller requested to indicate as current
Returns:
The current tab element.
getName
-
tab
Parameters:
-
tab
HTMLElementcorresponds to the tab
Returns:
the name of the tab
getUrl
-
tab
Parameters:
-
tab
HTMLElementcorresponds to the tab
Returns:
the url that the tab links to
indicateCurrent
-
[tab]
Parameters:
-
[tab]
String optionala possible tab the caller requested to indicate as current
refresh
()
Render the tabs element again and indicate the selected tab